package br.com.webhomesites.locacao.view;

import br.com.webhomesites.configuracao.model.CidadeModel;
import br.com.webhomesites.configuracao.model.EstadoModel;
import br.com.webhomesites.configuracao.utils.ConfiguracaoInstancias;
import br.com.webhomesites.locacao.contracts.IEmpresaManutencaoView;
import br.com.webhomesites.padrao.contracts.IDocument;
import br.com.webhomesites.padrao.utils.StrategyDocument;
import java.awt.Component;
import java.awt.event.ActionListener;
import java.awt.event.KeyListener;
import java.util.List;
import javax.swing.JTextField;

public class EmpresaManutencaoView extends javax.swing.JInternalFrame implements IEmpresaManutencaoView {

    //construtor da classe. carrega os componentes
    private IDocument doc;
    public EmpresaManutencaoView() {
        initComponents();
        setLocation(200, 200);
    }

    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        rgEmpresaManutencaoPessoa = new javax.swing.ButtonGroup();
        painelCentralEmpresaManutencao = new javax.swing.JPanel();
        labelEmpresaManutencaoRazaoSocial = new javax.swing.JLabel();
        txtEmpresaManutencaoNome = new javax.swing.JTextField();
        labelEmpresaManutencaoCodigo = new javax.swing.JLabel();
        labeEmpresaManutencaoCNPJ = new javax.swing.JLabel();
        txtEmpresaManutencaoCNPJ = new javax.swing.JTextField();
        txtEmpresaManutencaoCodigo = new javax.swing.JTextField();
        labelEmpresaManutencaoInscriacoEstadual = new javax.swing.JLabel();
        txtEmpresaManutencaoInscricaoEstadual = new javax.swing.JTextField();
        labelEmpresaManutencaoNome = new javax.swing.JLabel();
        txtEmpresaManutencaoRazaoSocial = new javax.swing.JTextField();
        rbPessoaFisicaEmpresaManutencao = new javax.swing.JRadioButton();
        rdPessoaJuridicaEmpresaManutencao = new javax.swing.JRadioButton();
        labelPessoaEmpresaManutencao = new javax.swing.JLabel();
        labelEmpresaManutencaoBairro = new javax.swing.JLabel();
        labelEmpresaManutencaoEstado = new javax.swing.JLabel();
        txtEmpresaManutencaoEndereco = new javax.swing.JTextField();
        txtEmpresaManutencaoTelefone = new javax.swing.JTextField();
        txtEmpresaManutencaoBairro = new javax.swing.JTextField();
        comboEmpresaManutencaoEstado = new javax.swing.JComboBox();
        comboEmpresaManutencaoCidade = new javax.swing.JComboBox();
        labelEmpresaManutencaoTelefone = new javax.swing.JLabel();
        labelEmpresaManutencaoEmail = new javax.swing.JLabel();
        labelEmpresaManutencaoCidade = new javax.swing.JLabel();
        txtEmpresaManutencaoEmail = new javax.swing.JTextField();
        labelEmpresaManutencaoEndereco = new javax.swing.JLabel();
        labeEmpresaManutencaoCpf = new javax.swing.JLabel();
        txtEmpresaManutencaoCpf = new javax.swing.JTextField();
        labelEmpresaManutencaoRg = new javax.swing.JLabel();
        txtEmpresaManutencaoRg = new javax.swing.JTextField();
        txtEmpresaManutencaoCelular = new javax.swing.JTextField();
        labelEmpresaManutencaoCelular = new javax.swing.JLabel();
        btnNovo = new javax.swing.JButton();
        btnRemover = new javax.swing.JButton();
        btnSalvar = new javax.swing.JButton();
        btnCancelar = new javax.swing.JButton();
        btnPesquisar = new javax.swing.JButton();

        setClosable(true);
        setIconifiable(true);

        painelCentralEmpresaManutencao.setBorder(javax.swing.BorderFactory.createTitledBorder("Cadastro de Empresa Manutencao"));
        painelCentralEmpresaManutencao.setPreferredSize(new java.awt.Dimension(486, 440));

        labelEmpresaManutencaoRazaoSocial.setText("Razão Social");

        txtEmpresaManutencaoNome.setColumns(5);

        labelEmpresaManutencaoCodigo.setText("Cód.Emp.Manut");

        labeEmpresaManutencaoCNPJ.setText("CNPJ");

        labelEmpresaManutencaoInscriacoEstadual.setText("Inscrição Estadual");

        labelEmpresaManutencaoNome.setText("Nome");

        txtEmpresaManutencaoRazaoSocial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtEmpresaManutencaoRazaoSocialActionPerformed(evt);
            }
        });

        rgEmpresaManutencaoPessoa.add(rbPessoaFisicaEmpresaManutencao);
        rbPessoaFisicaEmpresaManutencao.setText("Física");
        rbPessoaFisicaEmpresaManutencao.setActionCommand("F");

        rgEmpresaManutencaoPessoa.add(rdPessoaJuridicaEmpresaManutencao);
        rdPessoaJuridicaEmpresaManutencao.setText("Jurídica");
        rdPessoaJuridicaEmpresaManutencao.setActionCommand("J");

        labelPessoaEmpresaManutencao.setText("Pessoa");

        labelEmpresaManutencaoBairro.setText("Bairro");

        labelEmpresaManutencaoEstado.setText("Estado");

        txtEmpresaManutencaoEndereco.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtEmpresaManutencaoEnderecoActionPerformed(evt);
            }
        });

        labelEmpresaManutencaoTelefone.setText("Telefone");

        labelEmpresaManutencaoEmail.setText("E-mail");

        labelEmpresaManutencaoCidade.setText("Cidade");

        labelEmpresaManutencaoEndereco.setText("Endereço");

        labeEmpresaManutencaoCpf.setText("CPF");

        labelEmpresaManutencaoRg.setText("RG");

        labelEmpresaManutencaoCelular.setText("Celular");

        javax.swing.GroupLayout painelCentralEmpresaManutencaoLayout = new javax.swing.GroupLayout(painelCentralEmpresaManutencao);
        painelCentralEmpresaManutencao.setLayout(painelCentralEmpresaManutencaoLayout);
        painelCentralEmpresaManutencaoLayout.setHorizontalGroup(
            painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                                    .addComponent(labeEmpresaManutencaoCpf)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 220, Short.MAX_VALUE))
                                .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                                    .addComponent(txtEmpresaManutencaoCpf)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                            .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                                        .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(txtEmpresaManutencaoTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, 104, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addComponent(labelEmpresaManutencaoTelefone))
                                        .addGap(14, 14, 14)
                                        .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(labelEmpresaManutencaoCelular)
                                            .addComponent(txtEmpresaManutencaoCelular)))
                                    .addComponent(labelEmpresaManutencaoRg)
                                    .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                                        .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(labelEmpresaManutencaoCodigo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(txtEmpresaManutencaoCodigo))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                                                .addComponent(rbPessoaFisicaEmpresaManutencao)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(rdPessoaJuridicaEmpresaManutencao))
                                            .addComponent(labelPessoaEmpresaManutencao)))
                                    .addComponent(labelEmpresaManutencaoNome)
                                    .addComponent(txtEmpresaManutencaoNome, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtEmpresaManutencaoEndereco, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtEmpresaManutencaoRg, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                        .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(txtEmpresaManutencaoRazaoSocial, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE)
                            .addComponent(txtEmpresaManutencaoCNPJ)
                            .addComponent(txtEmpresaManutencaoInscricaoEstadual)
                            .addComponent(txtEmpresaManutencaoEmail)
                            .addComponent(txtEmpresaManutencaoBairro)))
                    .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                        .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                                .addGap(249, 249, 249)
                                .addComponent(labelEmpresaManutencaoRazaoSocial))
                            .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                                .addGap(249, 249, 249)
                                .addComponent(labeEmpresaManutencaoCNPJ))
                            .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(comboEmpresaManutencaoEstado, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(labelEmpresaManutencaoCidade))
                            .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(labelEmpresaManutencaoEstado))
                            .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                                .addGap(10, 10, 10)
                                .addComponent(comboEmpresaManutencaoCidade, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                                .addGap(249, 249, 249)
                                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(labelEmpresaManutencaoEmail)
                                    .addComponent(labelEmpresaManutencaoInscriacoEstadual)))
                            .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(labelEmpresaManutencaoEndereco)
                                .addGap(194, 194, 194)
                                .addComponent(labelEmpresaManutencaoBairro)))
                        .addGap(0, 212, Short.MAX_VALUE)))
                .addContainerGap())
        );

        painelCentralEmpresaManutencaoLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {txtEmpresaManutencaoCpf, txtEmpresaManutencaoNome});

        painelCentralEmpresaManutencaoLayout.setVerticalGroup(
            painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(painelCentralEmpresaManutencaoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelEmpresaManutencaoCodigo)
                    .addComponent(labelPessoaEmpresaManutencao))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtEmpresaManutencaoCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(rbPessoaFisicaEmpresaManutencao)
                    .addComponent(rdPessoaJuridicaEmpresaManutencao))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelEmpresaManutencaoNome, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(labelEmpresaManutencaoRazaoSocial, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtEmpresaManutencaoNome)
                    .addComponent(txtEmpresaManutencaoRazaoSocial))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labeEmpresaManutencaoCpf, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(labeEmpresaManutencaoCNPJ, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtEmpresaManutencaoCpf)
                    .addComponent(txtEmpresaManutencaoCNPJ))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelEmpresaManutencaoRg)
                    .addComponent(labelEmpresaManutencaoInscriacoEstadual))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtEmpresaManutencaoRg)
                    .addComponent(txtEmpresaManutencaoInscricaoEstadual))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelEmpresaManutencaoTelefone)
                    .addComponent(labelEmpresaManutencaoEmail)
                    .addComponent(labelEmpresaManutencaoCelular))
                .addGap(7, 7, 7)
                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtEmpresaManutencaoTelefone, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtEmpresaManutencaoEmail)
                    .addComponent(txtEmpresaManutencaoCelular))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelEmpresaManutencaoEndereco)
                    .addComponent(labelEmpresaManutencaoBairro))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(painelCentralEmpresaManutencaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtEmpresaManutencaoEndereco)
                    .addComponent(txtEmpresaManutencaoBairro))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(labelEmpresaManutencaoEstado)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(comboEmpresaManutencaoEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(13, 13, 13)
                .addComponent(labelEmpresaManutencaoCidade)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(comboEmpresaManutencaoCidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(108, 108, 108))
        );

        btnNovo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/document-icon.png"))); // NOI18N
        btnNovo.setMnemonic('n');

        btnRemover.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/delete-icon.png"))); // NOI18N
        btnRemover.setMnemonic('x');

        btnSalvar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/save-icon.png"))); // NOI18N
        btnSalvar.setMnemonic('s');

        btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/block-icon.png"))); // NOI18N
        btnCancelar.setMnemonic('c');

        btnPesquisar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagens/search-icon.png"))); // NOI18N
        btnPesquisar.setMnemonic('p');

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(btnNovo, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnSalvar, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnRemover, javax.swing.GroupLayout.PREFERRED_SIZE, 53, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(btnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnPesquisar, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addComponent(painelCentralEmpresaManutencao, javax.swing.GroupLayout.DEFAULT_SIZE, 570, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(painelCentralEmpresaManutencao, javax.swing.GroupLayout.PREFERRED_SIZE, 537, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(btnSalvar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnRemover, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnCancelar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnPesquisar, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnNovo, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(34, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void txtEmpresaManutencaoRazaoSocialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtEmpresaManutencaoRazaoSocialActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtEmpresaManutencaoRazaoSocialActionPerformed

    private void txtEmpresaManutencaoEnderecoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtEmpresaManutencaoEnderecoActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtEmpresaManutencaoEnderecoActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnCancelar;
    private javax.swing.JButton btnNovo;
    private javax.swing.JButton btnPesquisar;
    private javax.swing.JButton btnRemover;
    private javax.swing.JButton btnSalvar;
    private javax.swing.JComboBox comboEmpresaManutencaoCidade;
    private javax.swing.JComboBox comboEmpresaManutencaoEstado;
    private javax.swing.JLabel labeEmpresaManutencaoCNPJ;
    private javax.swing.JLabel labeEmpresaManutencaoCpf;
    private javax.swing.JLabel labelEmpresaManutencaoBairro;
    private javax.swing.JLabel labelEmpresaManutencaoCelular;
    private javax.swing.JLabel labelEmpresaManutencaoCidade;
    private javax.swing.JLabel labelEmpresaManutencaoCodigo;
    private javax.swing.JLabel labelEmpresaManutencaoEmail;
    private javax.swing.JLabel labelEmpresaManutencaoEndereco;
    private javax.swing.JLabel labelEmpresaManutencaoEstado;
    private javax.swing.JLabel labelEmpresaManutencaoInscriacoEstadual;
    private javax.swing.JLabel labelEmpresaManutencaoNome;
    private javax.swing.JLabel labelEmpresaManutencaoRazaoSocial;
    private javax.swing.JLabel labelEmpresaManutencaoRg;
    private javax.swing.JLabel labelEmpresaManutencaoTelefone;
    private javax.swing.JLabel labelPessoaEmpresaManutencao;
    private javax.swing.JPanel painelCentralEmpresaManutencao;
    private javax.swing.JRadioButton rbPessoaFisicaEmpresaManutencao;
    private javax.swing.JRadioButton rdPessoaJuridicaEmpresaManutencao;
    private javax.swing.ButtonGroup rgEmpresaManutencaoPessoa;
    private javax.swing.JTextField txtEmpresaManutencaoBairro;
    private javax.swing.JTextField txtEmpresaManutencaoCNPJ;
    private javax.swing.JTextField txtEmpresaManutencaoCelular;
    private javax.swing.JTextField txtEmpresaManutencaoCodigo;
    private javax.swing.JTextField txtEmpresaManutencaoCpf;
    private javax.swing.JTextField txtEmpresaManutencaoEmail;
    private javax.swing.JTextField txtEmpresaManutencaoEndereco;
    private javax.swing.JTextField txtEmpresaManutencaoInscricaoEstadual;
    private javax.swing.JTextField txtEmpresaManutencaoNome;
    private javax.swing.JTextField txtEmpresaManutencaoRazaoSocial;
    private javax.swing.JTextField txtEmpresaManutencaoRg;
    private javax.swing.JTextField txtEmpresaManutencaoTelefone;
    // End of variables declaration//GEN-END:variables

    @Override
    public void setCodigo(long codigo) {
        this.txtEmpresaManutencaoCodigo.setText((Long.toString(codigo)));
    }

    @Override
    public long getCodigo() {
        return Long.parseLong(txtEmpresaManutencaoCodigo.getText());
    }

    @Override
    public void setPessoa(String pessoa) {
        //this.rgEmpresaManutencaoPessoa.setSelected();
    }

    @Override
    public String getPessoa() {
        return this.rgEmpresaManutencaoPessoa.getSelection().getActionCommand();
    }

    @Override
    public void setNome(String nome) {
        this.txtEmpresaManutencaoNome.setText(nome);
    }

    @Override
    public String getNome() {
        return this.txtEmpresaManutencaoNome.getText();
    }

    @Override
    public void setCpf(String cpf) {
        this.txtEmpresaManutencaoCpf.setText(cpf);
    }

    @Override
    public String getCpf() {
        return this.txtEmpresaManutencaoCpf.getText();
    }

    @Override
    public void setRg(String rg) {
        this.txtEmpresaManutencaoRg.setText(rg);
    }

    @Override
    public String getRg() {
        return this.txtEmpresaManutencaoRg.getText();
    }

    @Override
    public void setCelular(String celular) {
        this.txtEmpresaManutencaoCelular.setText(celular);
    }

    @Override
    public String getCelular() {
        return this.txtEmpresaManutencaoCelular.getText();
    }

    @Override
    public void setRazaoSocial(String razaoSocial) {
        this.txtEmpresaManutencaoRazaoSocial.setText(razaoSocial);
    }

    @Override
    public String getRazaoSocial() {
        return txtEmpresaManutencaoRazaoSocial.getText();
    }

    @Override
    public void setCnpj(String cnpj) {
        this.txtEmpresaManutencaoCNPJ.setText(cnpj);
    }

    @Override
    public String getCnpj() {
        return txtEmpresaManutencaoCNPJ.getText();
    }

    @Override
    public void setInscricaoEstadual(String inscricaoEstadual) {
        this.txtEmpresaManutencaoInscricaoEstadual.setText(inscricaoEstadual);
    }

    @Override
    public String getInscricaoEstadual() {
        return txtEmpresaManutencaoInscricaoEstadual.getText();
    }

    @Override
    public void setEndereco(String endereco) {
        this.txtEmpresaManutencaoEndereco.setText(endereco);
    }

    @Override
    public String getEndereco() {
        return txtEmpresaManutencaoEndereco.getText();
    }

    @Override
    public void setBairro(String bairro) {
        this.txtEmpresaManutencaoBairro.setText(bairro);
    }

    @Override
    public String getBairro() {
        return txtEmpresaManutencaoBairro.getText();
    }

    @Override
    public void setCidade(List<CidadeModel> listaCidades) {

        for (int i = 0; i < listaCidades.size(); i++) // Percorro o Array List com o For aprimorado.  
        {
            this.comboEmpresaManutencaoCidade.addItem(listaCidades.get(i).getNome()); // Adiciono os dados.  
        }
    }

    @Override
    public String getCidade() {
        return comboEmpresaManutencaoCidade.getSelectedItem().toString();
    }

    @Override
    public void setEstado(List<EstadoModel> listaEstados) {

        for (int i = 0; i < listaEstados.size(); i++) // Percorro o Array List com o For aprimorado.  
        {
            this.comboEmpresaManutencaoEstado.addItem(listaEstados.get(i).getNome()); // Adiciono os dados.  
        }
    }

    @Override
    public String getEstado() {
        return comboEmpresaManutencaoEstado.getSelectedItem().toString();
    }

    @Override
    public void setTelefone(String telefone) {
        this.txtEmpresaManutencaoTelefone.setText(telefone);
    }

    @Override
    public String getTelefone() {
        return txtEmpresaManutencaoTelefone.getText();
    }

    @Override
    public void setEmail(String email) {
        this.txtEmpresaManutencaoEmail.setToolTipText(email);
    }

    @Override
    public String getEmail() {
        return txtEmpresaManutencaoEmail.getText();
    }

    @Override
    public void packAndShow() {
        //this.pack();  
        ConfiguracaoInstancias.getDesktop().getDesktop().add(this);
        //txtEmpresaManutencaoCodigo.setMaximumSize(4);
        //StrategyDocument.DocLetras;        
        txtEmpresaManutencaoBairro.setDocument(new StrategyDocument.DocLetras().getDocumentoPlano());
        txtEmpresaManutencaoNome.setDocument(new StrategyDocument.DocLetras().getDocumentoPlano());
        txtEmpresaManutencaoRazaoSocial.setDocument(new StrategyDocument.DocLetras().getDocumentoPlano());        
        txtEmpresaManutencaoNome.setDocument(new StrategyDocument.DocLetras().getDocumentoPlano());
        txtEmpresaManutencaoEndereco.setDocument(new StrategyDocument.DocEndereco().getDocumentoPlano());
        this.setVisible(true);
    }

    @Override
    public void clearFields() {
        Component[] componentesPainel;
        componentesPainel = painelCentralEmpresaManutencao.getComponents();
        for (int j = 0; j < componentesPainel.length; j++) {
            if (componentesPainel[j] instanceof JTextField) {
                JTextField field = (JTextField) componentesPainel[j];
                field.setText("");                
            }
        }
    }
    
    @Override
    public void putNull() {
        txtEmpresaManutencaoBairro = null;
        txtEmpresaManutencaoEndereco = null;
        txtEmpresaManutencaoNome = null;
        txtEmpresaManutencaoRazaoSocial = null;        
    }

    @Override
    public void enableTxtEmpresaManutencaoCodigo(boolean arg) {
        txtEmpresaManutencaoCodigo.setEnabled(arg);
    }

    @Override
    public void enableRgEmpresaManutencaoPessoa(boolean arg) {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void enableTxtEmpresaManutencaoNome(boolean arg) {
        this.txtEmpresaManutencaoNome.setEnabled(arg);
    }

    @Override
    public void enableTxtEmpresaManutencaoCpf(boolean arg) {
        this.txtEmpresaManutencaoCpf.setEnabled(arg);
    }

    @Override
    public void enableTxtEmpresaManutencaoRg(boolean arg) {
        this.txtEmpresaManutencaoRg.setEnabled(arg);
    }

    @Override
    public void enableTxtEmpresaManutencaoCelular(boolean arg) {
        this.txtEmpresaManutencaoCelular.setEnabled(arg);
    }

    @Override
    public void enableTxtEmpresaManutencaoRazaoSocial(boolean arg) {
        txtEmpresaManutencaoRazaoSocial.setEnabled(arg);
    }

    @Override
    public void enableTxtEmpresaManutencaoCnpj(boolean arg) {
        txtEmpresaManutencaoCNPJ.setEnabled(arg);
    }

    @Override
    public void enableTxtEmpresaManutencaoInscricaoEstadual(boolean arg) {
        txtEmpresaManutencaoInscricaoEstadual.setEnabled(arg);
    }

    @Override
    public void enableTxtEmpresaManutencaoEndereco(boolean arg) {
        txtEmpresaManutencaoEndereco.setEnabled(arg);
    }

    @Override
    public void enableTxtEmpresaManutencaoBairro(boolean arg) {
        txtEmpresaManutencaoBairro.setEnabled(arg);
    }

    @Override
    public void enableComboEmpresaManutencaoCidade(boolean arg) {
        comboEmpresaManutencaoCidade.setEnabled(arg);
    }

    @Override
    public void enableComboEmpresaManutencaoEstado(boolean arg) {
        comboEmpresaManutencaoEstado.setEnabled(arg);
    }

    @Override
    public void enableTxtEmpresaManutencaoTelefone(boolean arg) {
        txtEmpresaManutencaoTelefone.setEnabled(arg);
    }

    @Override
    public void enableTxtEmpresaManutencaoEmail(boolean arg) {
        txtEmpresaManutencaoEmail.setEnabled(arg);
    }

    @Override
    public void enableBtnAlterar(boolean arg) {
        this.btnPesquisar.setEnabled(arg);
    }

    @Override
    public void enableBtnRemover(boolean arg) {
        this.btnRemover.setEnabled(arg);
    }

    @Override
    public void enableBtnCancelar(boolean arg) {
        this.btnCancelar.setEnabled(arg);
    }

    @Override
    public void enableBtnSalvar(boolean arg) {
        this.btnSalvar.setEnabled(arg);
    }

    @Override
    public void enableBtnInserir(boolean arg) {
        this.btnNovo.setEnabled(arg);
    }

    @Override
    public void setInserirActionListener(ActionListener listener) {
        this.btnNovo.addActionListener(listener);
    }

    @Override
    public void setRemoverActionListener(ActionListener listener) {
        this.btnRemover.addActionListener(listener);
    }

    @Override
    public void setAlterarActionListener(ActionListener listener) {
        this.btnPesquisar.addActionListener(listener);
    }

    @Override
    public void setCancelarActionListener(ActionListener listener) {
        this.btnCancelar.addActionListener(listener);
    }

    @Override
    public void setSalvarActionListener(ActionListener listener) {
        this.btnSalvar.addActionListener(listener);
    }

    @Override
    public void setBtnSairActionListener(ActionListener listener) {
        //this.btnSair.addActionListener(listener); 
    }
    
    @Override
    public void setRbPessoaFisicaActionListener(ActionListener listener) {
        this.rbPessoaFisicaEmpresaManutencao.addActionListener(listener);
    }
    
    @Override
    public void setRbPessoaJuridicaActionListener(ActionListener listener) {
        this.rdPessoaJuridicaEmpresaManutencao.addActionListener(listener);
    }

    @Override
    public void removeAllitensComboEmpresaManutencaoCidade() {
        this.comboEmpresaManutencaoCidade.removeAllItems();
    }

    @Override
    public void removeAllitensComboEmpresaManutencaoEstado() {
        this.comboEmpresaManutencaoEstado.removeAllItems();
    }

    @Override
    public void setMascaraListener(KeyListener listener) {
        this.txtEmpresaManutencaoCNPJ.addKeyListener(listener);
        this.txtEmpresaManutencaoCpf.addKeyListener(listener);
        this.txtEmpresaManutencaoRg.addKeyListener(listener);
        this.txtEmpresaManutencaoTelefone.addKeyListener(listener);
        this.txtEmpresaManutencaoCelular.addKeyListener(listener);
    }

    @Override
    public boolean isRbPessoaFisica() {
        return this.rbPessoaFisicaEmpresaManutencao.isSelected();
    }

    @Override
    public boolean isRbPessoaJuridica() {
        return this.rdPessoaJuridicaEmpresaManutencao.isSelected();
    }
   
    @Override
    public void setPessoaFisicaSelected(boolean arg) {
        rbPessoaFisicaEmpresaManutencao.setSelected(arg);
    }
}
